<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: ActiveRecord::ConnectionAdapters::MysqlAdapter</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">ActiveRecord::ConnectionAdapters::MysqlAdapter</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter_rb.html">
                vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="AbstractAdapter.html">
                AbstractAdapter
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
The MySQL adapter will work with both Ruby/MySQL, which is a Ruby-based
MySQL adapter that comes bundled with Active Record, and with the faster
C-based MySQL/Ruby adapter (available both as a gem and from <a
href="http://www.tmtm.org/en/mysql/ruby">www.tmtm.org/en/mysql/ruby</a>/).
</p>
<p>
Options:
</p>
<ul>
<li><tt>:host</tt> - Defaults to &quot;localhost&quot;.

</li>
<li><tt>:port</tt> - Defaults to 3306.

</li>
<li><tt>:socket</tt> - Defaults to &quot;/tmp/mysql.sock&quot;.

</li>
<li><tt>:username</tt> - Defaults to &quot;root&quot;

</li>
<li><tt>:password</tt> - Defaults to nothing.

</li>
<li><tt>:database</tt> - The name of the database. No default, must be
provided.

</li>
<li><tt>:encoding</tt> - (Optional) Sets the client encoding by executing
&quot;SET NAMES &lt;encoding&gt;&quot; after connection.

</li>
<li><tt>:reconnect</tt> - Defaults to false (See MySQL documentation: <a
href="http://dev.mysql.com/doc/refman/5.0/en/auto-reconnect.html">dev.mysql.com/doc/refman/5.0/en/auto-reconnect.html</a>).

</li>
<li><tt>:sslca</tt> - Necessary to use MySQL with an SSL connection.

</li>
<li><tt>:sslkey</tt> - Necessary to use MySQL with an SSL connection.

</li>
<li><tt>:sslcert</tt> - Necessary to use MySQL with an SSL connection.

</li>
<li><tt>:sslcapath</tt> - Necessary to use MySQL with an SSL connection.

</li>
<li><tt>:sslcipher</tt> - Necessary to use MySQL with an SSL connection.

</li>
</ul>
<p>
By default, the <a href="MysqlAdapter.html">MysqlAdapter</a> will consider
all columns of type <tt>tinyint(1)</tt> as boolean. If you wish to disable
this emulation (which was the default behavior in versions 0.13.1 and
earlier) you can add the following line to your environment.rb file:
</p>
<pre>
  ActiveRecord::ConnectionAdapters::MysqlAdapter.emulate_booleans = false
</pre>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M001513">active?</a>&nbsp;&nbsp;
      <a href="#M001527">case_sensitive_equality_operator</a>&nbsp;&nbsp;
      <a href="#M001524">change_column_null</a>&nbsp;&nbsp;
      <a href="#M001520">charset</a>&nbsp;&nbsp;
      <a href="#M001521">collation</a>&nbsp;&nbsp;
      <a href="#M001518">create_database</a>&nbsp;&nbsp;
      <a href="#M001519">current_database</a>&nbsp;&nbsp;
      <a href="#M001515">disconnect!</a>&nbsp;&nbsp;
      <a href="#M001522">drop_table</a>&nbsp;&nbsp;
      <a href="#M001528">limited_update_conditions</a>&nbsp;&nbsp;
      <a href="#M001509">new</a>&nbsp;&nbsp;
      <a href="#M001510">quote</a>&nbsp;&nbsp;
      <a href="#M001512">quoted_false</a>&nbsp;&nbsp;
      <a href="#M001511">quoted_true</a>&nbsp;&nbsp;
      <a href="#M001514">reconnect!</a>&nbsp;&nbsp;
      <a href="#M001523">rename_table</a>&nbsp;&nbsp;
      <a href="#M001516">reset!</a>&nbsp;&nbsp;
      <a href="#M001517">select_rows</a>&nbsp;&nbsp;
      <a href="#M001526">show_variable</a>&nbsp;&nbsp;
      <a href="#M001525">type_to_sql</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">


    <div id="constants-list">
      <h3 class="section-bar">Constants</h3>

      <div class="name-list">
        <table summary="Constants">
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">ADAPTER_NAME</td>
          <td>=</td>
          <td class="context-item-value">'MySQL'.freeze</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">LOST_CONNECTION_ERROR_MESSAGES</td>
          <td>=</td>
          <td class="context-item-value">[         &quot;Server shutdown in progress&quot;,         &quot;Broken pipe&quot;,         &quot;Lost connection to MySQL server during query&quot;,         &quot;MySQL server has gone away&quot; ]</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">QUOTED_FALSE</td>
          <td>=</td>
          <td class="context-item-value">'1'.freeze, '0'.freeze</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">NATIVE_DATABASE_TYPES</td>
          <td>=</td>
          <td class="context-item-value">{         :primary_key =&gt; &quot;int(11) DEFAULT NULL auto_increment PRIMARY KEY&quot;.freeze,         :string      =&gt; { :name =&gt; &quot;varchar&quot;, :limit =&gt; 255 },         :text        =&gt; { :name =&gt; &quot;text&quot; },         :integer     =&gt; { :name =&gt; &quot;int&quot;, :limit =&gt; 4 },         :float       =&gt; { :name =&gt; &quot;float&quot; },         :decimal     =&gt; { :name =&gt; &quot;decimal&quot; },         :datetime    =&gt; { :name =&gt; &quot;datetime&quot; },         :timestamp   =&gt; { :name =&gt; &quot;datetime&quot; },         :time        =&gt; { :name =&gt; &quot;time&quot; },         :date        =&gt; { :name =&gt; &quot;date&quot; },         :binary      =&gt; { :name =&gt; &quot;blob&quot; },         :boolean     =&gt; { :name =&gt; &quot;tinyint&quot;, :limit =&gt; 1 }</td>
        </tr>
        </table>
      </div>
    </div>



      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M001509" class="method-detail">
        <a name="M001509"></a>

        <div class="method-heading">
          <a href="#M001509" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(connection, logger, connection_options, config)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001509-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001509-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 197</span>
197:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">connection</span>, <span class="ruby-identifier">logger</span>, <span class="ruby-identifier">connection_options</span>, <span class="ruby-identifier">config</span>)
198:         <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">connection</span>, <span class="ruby-identifier">logger</span>)
199:         <span class="ruby-ivar">@connection_options</span>, <span class="ruby-ivar">@config</span> = <span class="ruby-identifier">connection_options</span>, <span class="ruby-identifier">config</span>
200:         <span class="ruby-ivar">@quoted_column_names</span>, <span class="ruby-ivar">@quoted_table_names</span> = {}, {}
201:         <span class="ruby-identifier">connect</span>
202:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M001513" class="method-detail">
        <a name="M001513"></a>

        <div class="method-heading">
          <a href="#M001513" class="method-signature">
          <span class="method-name">active?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
CONNECTION MANAGEMENT ====================================
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001513-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001513-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 265</span>
265:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">active?</span>
266:         <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:stat</span>)
267:           <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">stat</span>
268:         <span class="ruby-keyword kw">else</span>
269:           <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">query</span> <span class="ruby-value str">'select 1'</span>
270:         <span class="ruby-keyword kw">end</span>
271: 
272:         <span class="ruby-comment cmt"># mysql-ruby doesn't raise an exception when stat fails.</span>
273:         <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:errno</span>)
274:           <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">errno</span>.<span class="ruby-identifier">zero?</span>
275:         <span class="ruby-keyword kw">else</span>
276:           <span class="ruby-keyword kw">true</span>
277:         <span class="ruby-keyword kw">end</span>
278:       <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Mysql</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span>
279:         <span class="ruby-keyword kw">false</span>
280:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001527" class="method-detail">
        <a name="M001527"></a>

        <div class="method-heading">
          <a href="#M001527" class="method-signature">
          <span class="method-name">case_sensitive_equality_operator</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001527-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001527-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 530</span>
530:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">case_sensitive_equality_operator</span>
531:         <span class="ruby-value str">&quot;= BINARY&quot;</span>
532:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001524" class="method-detail">
        <a name="M001524"></a>

        <div class="method-heading">
          <a href="#M001524" class="method-signature">
          <span class="method-name">change_column_null</span><span class="method-args">(table_name, column_name, null, default = nil)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001524-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001524-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 460</span>
460:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">change_column_null</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">column_name</span>, <span class="ruby-identifier">null</span>, <span class="ruby-identifier">default</span> = <span class="ruby-keyword kw">nil</span>)
461:         <span class="ruby-identifier">column</span> = <span class="ruby-identifier">column_for</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">column_name</span>)
462: 
463:         <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">null</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">default</span>.<span class="ruby-identifier">nil?</span>
464:           <span class="ruby-identifier">execute</span>(<span class="ruby-node">&quot;UPDATE #{quote_table_name(table_name)} SET #{quote_column_name(column_name)}=#{quote(default)} WHERE #{quote_column_name(column_name)} IS NULL&quot;</span>)
465:         <span class="ruby-keyword kw">end</span>
466: 
467:         <span class="ruby-identifier">change_column</span> <span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">column_name</span>, <span class="ruby-identifier">column</span>.<span class="ruby-identifier">sql_type</span>, <span class="ruby-identifier">:null</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">null</span>
468:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001520" class="method-detail">
        <a name="M001520"></a>

        <div class="method-heading">
          <a href="#M001520" class="method-signature">
          <span class="method-name">charset</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the database character set.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001520-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001520-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 406</span>
406:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">charset</span>
407:         <span class="ruby-identifier">show_variable</span> <span class="ruby-value str">'character_set_database'</span>
408:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001521" class="method-detail">
        <a name="M001521"></a>

        <div class="method-heading">
          <a href="#M001521" class="method-signature">
          <span class="method-name">collation</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the database <a href="MysqlAdapter.html#M001521">collation</a>
strategy.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001521-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001521-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 411</span>
411:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">collation</span>
412:         <span class="ruby-identifier">show_variable</span> <span class="ruby-value str">'collation_database'</span>
413:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001518" class="method-detail">
        <a name="M001518"></a>

        <div class="method-heading">
          <a href="#M001518" class="method-signature">
          <span class="method-name">create_database</span><span class="method-args">(name, options = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Create a <a href="MysqlAdapter.html#M001509">new</a> MySQL database with
optional <tt>:<a href="MysqlAdapter.html#M001520">charset</a></tt> and
<tt>:<a href="MysqlAdapter.html#M001521">collation</a></tt>. Charset
defaults to utf8.
</p>
<p>
Example:
</p>
<pre>
  create_database 'charset_test', :charset =&gt; 'latin1', :collation =&gt; 'latin1_bin'
  create_database 'matt_development'
  create_database 'matt_development', :charset =&gt; :big5
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001518-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001518-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 389</span>
389:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_database</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span> = {})
390:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:collation</span>]
391:           <span class="ruby-identifier">execute</span> <span class="ruby-node">&quot;CREATE DATABASE `#{name}` DEFAULT CHARACTER SET `#{options[:charset] || 'utf8'}` COLLATE `#{options[:collation]}`&quot;</span>
392:         <span class="ruby-keyword kw">else</span>
393:           <span class="ruby-identifier">execute</span> <span class="ruby-node">&quot;CREATE DATABASE `#{name}` DEFAULT CHARACTER SET `#{options[:charset] || 'utf8'}`&quot;</span>
394:         <span class="ruby-keyword kw">end</span>
395:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001519" class="method-detail">
        <a name="M001519"></a>

        <div class="method-heading">
          <a href="#M001519" class="method-signature">
          <span class="method-name">current_database</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001519-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001519-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 401</span>
401:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">current_database</span>
402:         <span class="ruby-identifier">select_value</span> <span class="ruby-value str">'SELECT DATABASE() as db'</span>
403:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001515" class="method-detail">
        <a name="M001515"></a>

        <div class="method-heading">
          <a href="#M001515" class="method-signature">
          <span class="method-name">disconnect!</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001515-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001515-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 287</span>
287:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">disconnect!</span>
288:         <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
289:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001522" class="method-detail">
        <a name="M001522"></a>

        <div class="method-heading">
          <a href="#M001522" class="method-signature">
          <span class="method-name">drop_table</span><span class="method-args">(table_name, options = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001522-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001522-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 421</span>
421:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">drop_table</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">options</span> = {})
422:         <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">options</span>)
423:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001528" class="method-detail">
        <a name="M001528"></a>

        <div class="method-heading">
          <a href="#M001528" class="method-signature">
          <span class="method-name">limited_update_conditions</span><span class="method-args">(where_sql, quoted_table_name, quoted_primary_key)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001528-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001528-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 534</span>
534:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">limited_update_conditions</span>(<span class="ruby-identifier">where_sql</span>, <span class="ruby-identifier">quoted_table_name</span>, <span class="ruby-identifier">quoted_primary_key</span>)
535:         <span class="ruby-identifier">where_sql</span>
536:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001510" class="method-detail">
        <a name="M001510"></a>

        <div class="method-heading">
          <a href="#M001510" class="method-signature">
          <span class="method-name">quote</span><span class="method-args">(value, column = nil)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
QUOTING ==================================================
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001510-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001510-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 219</span>
219:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">quote</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">column</span> = <span class="ruby-keyword kw">nil</span>)
220:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">String</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">column</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">column</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:binary</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">column</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:string_to_binary</span>)
221:           <span class="ruby-identifier">s</span> = <span class="ruby-identifier">column</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">string_to_binary</span>(<span class="ruby-identifier">value</span>).<span class="ruby-identifier">unpack</span>(<span class="ruby-value str">&quot;H*&quot;</span>)[<span class="ruby-value">0</span>]
222:           <span class="ruby-node">&quot;x'#{s}'&quot;</span>
223:         <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">BigDecimal</span>)
224:           <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_s</span>(<span class="ruby-value str">&quot;F&quot;</span>)
225:         <span class="ruby-keyword kw">else</span>
226:           <span class="ruby-keyword kw">super</span>
227:         <span class="ruby-keyword kw">end</span>
228:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001512" class="method-detail">
        <a name="M001512"></a>

        <div class="method-heading">
          <a href="#M001512" class="method-signature">
          <span class="method-name">quoted_false</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001512-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001512-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 246</span>
246:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">quoted_false</span>
247:         <span class="ruby-constant">QUOTED_FALSE</span>
248:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001511" class="method-detail">
        <a name="M001511"></a>

        <div class="method-heading">
          <a href="#M001511" class="method-signature">
          <span class="method-name">quoted_true</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001511-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001511-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 242</span>
242:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">quoted_true</span>
243:         <span class="ruby-constant">QUOTED_TRUE</span>
244:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001514" class="method-detail">
        <a name="M001514"></a>

        <div class="method-heading">
          <a href="#M001514" class="method-signature">
          <span class="method-name">reconnect!</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001514-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001514-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 282</span>
282:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reconnect!</span>
283:         <span class="ruby-identifier">disconnect!</span>
284:         <span class="ruby-identifier">connect</span>
285:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001523" class="method-detail">
        <a name="M001523"></a>

        <div class="method-heading">
          <a href="#M001523" class="method-signature">
          <span class="method-name">rename_table</span><span class="method-args">(table_name, new_name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001523-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001523-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 451</span>
451:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rename_table</span>(<span class="ruby-identifier">table_name</span>, <span class="ruby-identifier">new_name</span>)
452:         <span class="ruby-identifier">execute</span> <span class="ruby-node">&quot;RENAME TABLE #{quote_table_name(table_name)} TO #{quote_table_name(new_name)}&quot;</span>
453:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001516" class="method-detail">
        <a name="M001516"></a>

        <div class="method-heading">
          <a href="#M001516" class="method-signature">
          <span class="method-name">reset!</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001516-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001516-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 291</span>
291:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset!</span>
292:         <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:change_user</span>)
293:           <span class="ruby-comment cmt"># See http://bugs.mysql.com/bug.php?id=33540 -- the workaround way to</span>
294:           <span class="ruby-comment cmt"># reset the connection is to change the user to the same user.</span>
295:           <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">change_user</span>(<span class="ruby-ivar">@config</span>[<span class="ruby-identifier">:username</span>], <span class="ruby-ivar">@config</span>[<span class="ruby-identifier">:password</span>], <span class="ruby-ivar">@config</span>[<span class="ruby-identifier">:database</span>])
296:           <span class="ruby-identifier">configure_connection</span>
297:         <span class="ruby-keyword kw">end</span>
298:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001517" class="method-detail">
        <a name="M001517"></a>

        <div class="method-heading">
          <a href="#M001517" class="method-signature">
          <span class="method-name">select_rows</span><span class="method-args">(sql, name = nil)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
DATABASE STATEMENTS ======================================
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001517-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001517-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 302</span>
302:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">select_rows</span>(<span class="ruby-identifier">sql</span>, <span class="ruby-identifier">name</span> = <span class="ruby-keyword kw">nil</span>)
303:         <span class="ruby-ivar">@connection</span>.<span class="ruby-identifier">query_with_result</span> = <span class="ruby-keyword kw">true</span>
304:         <span class="ruby-identifier">result</span> = <span class="ruby-identifier">execute</span>(<span class="ruby-identifier">sql</span>, <span class="ruby-identifier">name</span>)
305:         <span class="ruby-identifier">rows</span> = []
306:         <span class="ruby-identifier">result</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">row</span><span class="ruby-operator">|</span> <span class="ruby-identifier">rows</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">row</span> }
307:         <span class="ruby-identifier">result</span>.<span class="ruby-identifier">free</span>
308:         <span class="ruby-identifier">rows</span>
309:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001526" class="method-detail">
        <a name="M001526"></a>

        <div class="method-heading">
          <a href="#M001526" class="method-signature">
          <span class="method-name">show_variable</span><span class="method-args">(name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
SHOW VARIABLES LIKE &#8216;name&#8216;
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001526-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001526-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 516</span>
516:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">show_variable</span>(<span class="ruby-identifier">name</span>)
517:         <span class="ruby-identifier">variables</span> = <span class="ruby-identifier">select_all</span>(<span class="ruby-node">&quot;SHOW VARIABLES LIKE '#{name}'&quot;</span>)
518:         <span class="ruby-identifier">variables</span>.<span class="ruby-identifier">first</span>[<span class="ruby-value str">'Value'</span>] <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">variables</span>.<span class="ruby-identifier">empty?</span>
519:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001525" class="method-detail">
        <a name="M001525"></a>

        <div class="method-heading">
          <a href="#M001525" class="method-signature">
          <span class="method-name">type_to_sql</span><span class="method-args">(type, limit = nil, precision = nil, scale = nil)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Maps logical <a href="../../Rails.html">Rails</a> types to MySQL-specific
data types.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001525-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001525-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 501</span>
501:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">type_to_sql</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">limit</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">precision</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">scale</span> = <span class="ruby-keyword kw">nil</span>)
502:         <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">super</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'integer'</span>
503: 
504:         <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">limit</span>
505:         <span class="ruby-keyword kw">when</span> <span class="ruby-value">1</span>; <span class="ruby-value str">'tinyint'</span>
506:         <span class="ruby-keyword kw">when</span> <span class="ruby-value">2</span>; <span class="ruby-value str">'smallint'</span>
507:         <span class="ruby-keyword kw">when</span> <span class="ruby-value">3</span>; <span class="ruby-value str">'mediumint'</span>
508:         <span class="ruby-keyword kw">when</span> <span class="ruby-keyword kw">nil</span>, <span class="ruby-value">4</span>, <span class="ruby-value">11</span>; <span class="ruby-value str">'int(11)'</span>  <span class="ruby-comment cmt"># compatibility with MySQL default</span>
509:         <span class="ruby-keyword kw">when</span> <span class="ruby-value">5</span><span class="ruby-operator">..</span><span class="ruby-value">8</span>; <span class="ruby-value str">'bigint'</span>
510:         <span class="ruby-keyword kw">else</span> <span class="ruby-identifier">raise</span>(<span class="ruby-constant">ActiveRecordError</span>, <span class="ruby-node">&quot;No integer type has byte size #{limit}&quot;</span>)
511:         <span class="ruby-keyword kw">end</span>
512:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>